#include <iostream>
#include <stdio.h>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long LL;
int main() {
    int n;
    scanf("%d", &n);
    LL st, en;
    set<LL> p_st, p_en;
    vector<LL> list;
    for (int i=0; i<n; ++i) {
        scanf("%lld %lld", &st, &en);
        p_st.insert(st);
        p_en.insert(en);
        list.push_back(st); list.push_back(en);
    }
    sort(list.begin(), list.end());
    int res=0, cnt=0;
    int len=list.size();
    for (int i=0; i<len; ++i) {
        if (p_st.count(list[i])) ++cnt;
        if (p_en.count(list[i])) --cnt;
        if (cnt>res) res=cnt;
    }
    printf("%d\n", res);
    return 0;
}
